home *** CD-ROM | disk | FTP | other *** search
/ PC & Mediji 1998 February / PCM_9802.iso / programi / director / data.z / Simple Child Object.dir / 00003_Script_Ball Parent Script < prev    next >
Text File  |  1997-05-10  |  759b  |  30 lines

  1. property HorizPos
  2.  
  3. on new me
  4.   -- when the sprite is created, it's placed on the stage
  5.   set the horizPos of me to 200
  6.   set the locH of sprite 2 to the horizPos of me
  7.   set the locV of sprite 2 to 120
  8.   return me
  9. end new
  10.  
  11.  
  12. on moveBall me, direction
  13.   set the horizPos of me to direction * 50 + the horizPos of me
  14.   set stageWidth to the stageRight - the stageLeft
  15.   
  16.   -- when more than half of the sprite has passed off stage,
  17.   -- it is made to appear on the opposite end of the stage
  18.   if the horizPos of me > (stageWidth + 99) then 
  19.     set the horizPos of me to 0 
  20.   end if
  21.   
  22.   
  23.   if the horizPos of me < -99 then 
  24.     set the horizPos of me to stageWidth
  25.   end if
  26.   
  27.   set the locH of sprite 2 to horizPos
  28.   
  29. end moveBall
  30.